/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mx.itschapala.dsw2.estacionamiento.modelo;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Lindemann
 */
@Entity
@Table(name = "estacionamiento")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Estacionamiento.findAll", query = "SELECT e FROM Estacionamiento e"),
    @NamedQuery(name = "Estacionamiento.findById", query = "SELECT e FROM Estacionamiento e WHERE e.id = :id"),
    @NamedQuery(name = "Estacionamiento.findByLugares", query = "SELECT e FROM Estacionamiento e WHERE e.lugares = :lugares"),
    @NamedQuery(name = "Estacionamiento.findByZona", query = "SELECT e FROM Estacionamiento e WHERE e.zona = :zona"),
@NamedQuery(name = "Estacionamiento.findDuplicity", query = "SELECT e FROM Estacionamiento e WHERE e.lugares = :lugares AND e.zona = :zona")
})
public class Estacionamiento implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "lugares")
    private String lugares;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "zona")
    private String zona;

    public Estacionamiento() {
    }

    public Estacionamiento(Integer id) {
        this.id = id;
    }

    public Estacionamiento(Integer id, String lugares, String zona) {
        this.id = id;
        this.lugares = lugares;
        this.zona = zona;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getLugares() {
        return lugares;
    }

    public void setLugares(String lugares) {
        this.lugares = lugares;
    }

    public String getZona() {
        return zona;
    }

    public void setZona(String zona) {
        this.zona = zona;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Estacionamiento)) {
            return false;
        }
        Estacionamiento other = (Estacionamiento) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return lugares+" "+zona;
    }
    
}
